<#--<#include "../layout/base.ftl">-->
<#--<#macro header>-->
<style type="text/css">
    #other-search-panel span.label {
        margin-left: 10px;
    }

    #other-search-panel .input-text {
        border: 1px solid #6D869E;
        height: 18px;
        vertical-align: middle;
        width: 137px;
    }

    #other-search-panel span.om-combo, #other-search-panel span.om-calendar {
        vertical-align: middle;
    }

    .form {
        float: left;
        width: 100%;
        text-align: left;
        border-collapse: collapse;
        background: #fff;
    }

    .form caption {
        font-size: 16px;
        font-weight: bold;
        letter-spacing: 2px;
        color: #19609d
    }

    .form th {
        text-align: right;
        font-size: 14px
    }

    .form tr, .form td {
        padding-left: 3px;
        height: 25px
    }

    .form a:link, .form a:visited {
        color: #246ab5;
        text-decoration: underline
    }

    .form a:hover, .form a:active {
        text-decoration: underline
    }

    .se {
        background: #fafbfe
    }

    .outtable {
        border-collapse: collapse;
    }

    .outtable th {
        border: 1px #d9dde1 solid;
        font-weight: normal;
        color: #173d72;
        text-align: left;
        text-indent: 6px;
        background: #fafbfe;
    }

    .outtable td {
        border: 1px #d9dde1 solid;
        padding: 3px;
        font-size: 14px;
        background: #fff
    }

</style>
<script type="text/javascript">
    $(function () {
        $("#other-search-panel").omPanel({
            title:"高级搜索"
        });

        $('span#other-button-search').omButton({
            width:70,
            icons:{left:'${base}/css/default/images/advanced/search.png'},
            onClick:function (event) {
                var url = "${base}/cfg/other_grid_json?companyId="+$("#other_companyName").val();
                $('#other_grid').omGrid("setData", encodeURI(url));
            }
        });

        $('#user_button_bar').omButtonbar({
            width:'100%',
            btns:[
                {id:"save_user",
                    icons:{left:'${base}/css/default/images/edit_add.png'},
                    label:"保存用户映射",
                    onClick:function () {
                        var data="[";
                        var rows=$('#other_grid').omGrid('getData').rows;
                        for(var i=0;i<rows.length;i++){
                            var code=$("input[name='companyCode']")[i].value;

                            data+="{'companyId1':'"+$("#other_companyName").val()+"','companyId2':'"+ rows[i].id+"','code':'"+ code +"'}";
                            data+=','
                        }
                        if(data.length>1)
                            data=data.substring(data,data.length-1)+']';
                        $.post('${base}/cfg/save_other_grid',{'data':data},function(data){
                            var url = "${base}/cfg/other_grid_json?companyId="+$("#other_companyName").val();
                            $('#other_grid').omGrid("setData", encodeURI(url));
                        });
                    }
                }
            ]
        });


        var url = "${base}/cfg/other_grid_json?companyId="+$("#other_companyName").val();

        var grid = $('#other_grid').omGrid({
            dataSource:encodeURI(url),
            height:350,
            width:'fit',
            autoFit:true,
            limit:100,

            colModel:[
                {header:'公司名称', name:'companyName', align:'left'},
                {header : '财务代码', name : 'code',  align:'center', renderer:function(colValue, rowData, rowIndex){
                    var data = rowData;
                    return '<input name="companyCode" type="text" ondblclick="alert(\'test\');" value="'+colValue+'"></input>';
                }}
            ]
        });

        $(window).scroll(function () {
            $("#other_grid").omGrid('resize');
        });
    });


</script>
<#--</#macro>-->
<#--<#macro body>-->
<div id="other-search-panel">
    <div style="width: 800px;">
        <span class="label">类型：</span>
        <select id="other_companyName">
            <option value=""></option>
        <#if companyList??&&companyList?size&gt;0>
            <#list companyList as temp>
            <option value="${temp[0]}">${temp[1]}</option>
            </#list>
        </#if>
        </select>
        <span id="other-button-search">搜索</span>
    </div>
</div>
<div id="other_button_bar"/>
<table id="other_grid">

</table>

